// pages/menu/menu.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    selectedIndex: 0,
    menus: [{ // 分类商品信息列表
        sort: 1,
        name: "奈雪早餐",
        id: 6905,
        goods_list: [{
            content: "购买三明治,享早餐指定饮品半价",
            id: 65825,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐",
            price: 20
          }, {
            content: "购买三明治,享早餐指定饮品半价",
            id: 658265,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐5",
            price: 21
          }, {
            content: "购买三明治,享早餐指定饮品半价",
            id: 658264,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐6",
            price: 21
          }, {
            content: "购买三明治,享早餐指定饮品半价",
            id: 658263,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐7",
            price: 21
          }, {
            content: "购买三明治,享早餐指定饮品半价",
            id: 658262,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐8",
            price: 21
          }, {
            content: "购买三明治,享早餐指定饮品半价",
            id: 658261,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐9",
            price: 21
          },
          {
            content: "购买三明治,享早餐指定饮品半价",
            id: 65827,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/19/fda6dd99c83af02353.jpg?imageView2/2/w/400/h/400",
            name: "奈雪早餐10",
            price: 22
          }
        ]
      },
      {
        sort: 2,
        name: "新品推荐",
        id: 6208,
        goods_list: [{
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 223306,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 245162233,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 223,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 2233,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 22333,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          },
          {
            content: "精选北川半兵卫抹茶粉和秘制红豆泥",
            id: 24517,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/99daa7b20061efab10.jpg?imageView2/2/w/400/h/400",
            name: "抹茶王",
            price: 18
          },
          {
            content: "饱满大颗的新鲜杨梅,满杯手工去核,搭配茉莉初雪茶底,清爽多汁",
            id: 68339,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/26/559a075d81060b23c7.jpg?imageView2/2/w/400/h/400",
            name: "霸气杨梅",
            price: 30
          }
        ]
      },
      {
        sort: 3,
        name: "最热单品",
        id: 6288,
        goods_list: [{
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 223306,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "霸气侧漏",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 245162233,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 223,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 2233,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          }, {
            content: "酥软口感,进口奶油搭配特制巧克力内馅",
            id: 22333,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/4a62ee45dd527609ed.jpg?imageView2/2/w/400/h/400",
            name: "脏脏王",
            price: 18
          },
          {
            content: "精选北川半兵卫抹茶粉和秘制红豆泥",
            id: 24517,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/29/99daa7b20061efab10.jpg?imageView2/2/w/400/h/400",
            name: "抹茶王",
            price: 18
          },
          {
            content: "饱满大颗的新鲜杨梅,满杯手工去核,搭配茉莉初雪茶底,清爽多汁",
            id: 68339,
            images: "https://img-shop.qmimg.cn/s23107/2020/04/26/559a075d81060b23c7.jpg?imageView2/2/w/400/h/400",
            name: "霸气杨梅",
            price: 30
          }
        ]
      }
    ]
  },
  handleClickLeftMenu(event){
    var index=event.currentTarget.dataset.index;
    console.log("d点击左侧菜单栏，当前点击的菜单栏对应的下标值为=》",index);
    this.setData({
      selectedIndex:index
    })
  },
  handleRightMenu(){
    var len = this.data.menus.length || 1;
    console.log("左侧菜单栏的数组长度值=》",len);
    this.setData({
      selectedIndex:(this.data.selectedIndex + 1)%len
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})